package com.daxidi.cn.controller;

import com.daxidi.cn.annotation.LogAnnotation;
import com.daxidi.cn.enums.LogTypeEnum;
import com.daxidi.cn.service.IMemberService;
import com.daxidi.cn.utils.ReturnResult;
import com.daxidi.cn.utils.ReturnResultUtils;
import com.daxidi.cn.vo.MemberBillVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@Api(tags = "消费记录模块")
@RestController
@RequestMapping("/api/v1/union/expense")
public class ExpenseController {


    @Autowired
    private IMemberService memberService;

    @LogAnnotation(content = "消费记录log", type = LogTypeEnum.SELECT)
    @ApiOperation(value = "消费记录接口")
    @GetMapping("/{memberId}")
    public ReturnResult consumption(@PathVariable("memberId") Long memberId) {
        List<MemberBillVo> memberVos = memberService.consumption(memberId);
        return ReturnResultUtils.returnSuccess(memberVos);
    }
}
